package com.exp.sys.service;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Component;

import tk.mybatis.mapper.entity.Example;

import com.exp.sys.entity.Admin;
import com.exp.sys.entity.Role;
import com.exp.sys.mapper.AdminMapper;
import com.exp.sys.mapper.RoleMapper;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Component
public class RoleService extends BaseService<Role,RoleMapper> {
	@Resource
	CacheManager cacheManager;
	
	@Override
	@Resource
	public void setMapper(RoleMapper mapper) {
		super.setMapper(mapper);
	}
	
	public void deleteWithRelate(String[] ids){
		Cache cache = cacheManager.getCache("adminVo");
		for(String id:ids){
			cache.evict(id);
		}
		delete(ids);
		mapper.deleteRoleAdmin(Arrays.asList(ids));
	}
}
